package com.testpro.DesignPattern.FactoryPattern;

public class test {

    public static void main(String[] args) {

        CarFactory carFactory = new CarFactory();
        Car car = carFactory.getnewCar();
        car.startCar();
        Car oldCar = carFactory.getOldCar();
        oldCar.startCar();
        Car newCar = carFactory.getInstanceForString("newCar");
        newCar.startCar();
        Car oldCar1 = carFactory.getInstanceForString("oldCar");
        oldCar1.startCar();
        Car msld = carFactory.getInstanceForString("来一个玛莎拉蒂");
        msld.startCar();
    }
}
